package com.hrpmar.controller;

import com.hrpmar.pojo.Drugstorage;
import com.hrpmar.pojo.Dsdetails;
import com.hrpmar.pojo.Osdetails;
import com.hrpmar.pojo.Outstorage;
import com.hrpmar.service.DruginfoService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by c on 2017-11-29.
 */
@Controller
@RequestMapping("/drug")
public class DrugInfoController {

    @Resource
    private DruginfoService druginfoService;

    @RequestMapping("/searchOneRu")
    public String searchOneRu(String dsNum, Model model){
        Drugstorage drugstorage = druginfoService.getStoByNum(dsNum);
        List<Dsdetails> list = druginfoService.getdelsByNum(dsNum);
        model.addAttribute("drugsto",drugstorage);
        model.addAttribute("list",list);
        return "drug/addlogDetails";
    }
    @RequestMapping("/searchOneChu")
    public String searchOneChu(String osNum,Model model){
        Outstorage outstorage = druginfoService.searchOutstorage(osNum);
        List<Osdetails> list = druginfoService.searchOsdetails(osNum);
        model.addAttribute("outsto",outstorage);
        model.addAttribute("list",list);
        return "drug/poslogDetails";
    }

}
